package com.seele.tigerwallet.ui.adapter;

import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.seele.tigerwallet.R;
import com.seele.tigerwallet.model.MarketModel;
import com.seele.tigerwallet.model.UserInfo;
import com.seele.tigerwallet.ui.manager.GlideManager;
import com.seele.tigerwallet.ui.views.SwitchView;

public class MoreSreachAdapter extends BaseQuickAdapter<MarketModel, BaseViewHolder> {

    private OnSreachClickListener mListener;

    public interface OnSreachClickListener {
        void onSwitchViewClick(int adapterPosition, MarketModel item);
    }

    public void setOnSreachClickListener(OnSreachClickListener listener) {
        this.mListener = listener;

    }

    public MoreSreachAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(final BaseViewHolder helper, final MarketModel item) {
        if (!TextUtils.isEmpty(item.symbol)) {
            helper.setText(R.id.token_name_tv, item.symbol);
        }

        if (item.isOpen) {
            helper.setImageResource(R.id.check_img, R.drawable.icon_add_select);
            helper.setBackgroundRes(R.id.check_ll, R.drawable.item_normal);
            helper.setBackgroundRes(R.id.add_rv, R.drawable.item_normal);
        }else {
            helper.setImageResource(R.id.check_img, R.drawable.icon_add_normal);
            helper.setBackgroundRes(R.id.check_ll, R.drawable.item_selector);
            helper.setBackgroundRes(R.id.add_rv, R.drawable.item_selector);
        }

        ImageView imageView = helper.getView(R.id.token_icon_img);
        GlideManager.loadUrl(mContext,item.id + "",imageView);


        helper.addOnClickListener(R.id.check_ll);



    }
}
